#include "els.h"
int ELSAPI_stdthread_stdthread_create(els_VmObj* vm); // stdthread_create(obj: object,f: def,...): ptr   '''创建一个新线程,调用脚本中的函数 f ,并传递参数'''
int ELSAPI_stdthread_stdthread_exit(els_VmObj* vm); // stdthread_exit(): int                           '''退出当前线程'''
int ELSAPI_stdthread_stdthread_join(els_VmObj* vm); // stdthread_join(obj: object): int                '''阻塞至线程结束'''
int ELSAPI_stdthread_stdthread_detach(els_VmObj* vm); // stdthread_detach(obj: object): int              '''分离当前线程'''
int ELSAPI_stdthread_stdthread_cancel(els_VmObj* vm); // stdthread_cancel(obj: object): int              '''终止当前线程'''
int ELSAPI_stdthread_stdthread_self(els_VmObj* vm); // stdthread_self(): pid                           '''返回当前的PID'''
#ifdef ELS_CONF_TOKEN_EN
static const char LibScript[]={
116,104,114,101,97,100,61,123,125,10,
100,101,102,32,116,104,114,101,97,100,46,99,108,97,115,115,40,41,58,32,10,
32,32,32,32,118,97,114,32,116,104,105,115,32,61,32,123,125,10,
32,32,32,32,116,104,105,115,46,99,114,101,97,116,101,32,61,32,115,116,100,116,104,114,101,97,100,95,99,114,101,97,116,101,10,
32,32,32,32,116,104,105,115,46,106,111,105,110,32,32,32,61,32,115,116,100,116,104,114,101,97,100,95,106,111,105,110,10,
32,32,32,32,116,104,105,115,46,100,101,116,97,99,104,32,61,32,115,116,100,116,104,114,101,97,100,95,100,101,116,97,99,104,10,
32,32,32,32,116,104,105,115,46,101,120,105,116,32,32,32,61,32,115,116,100,116,104,114,101,97,100,95,101,120,105,116,10,
32,32,32,32,116,104,105,115,46,115,101,108,102,32,32,32,61,32,115,116,100,116,104,114,101,97,100,95,115,101,108,102,32,32,32,10,
32,32,32,32,114,101,116,117,114,110,32,116,104,105,115,10,
59,10,
116,104,114,101,97,100,46,99,97,110,99,101,108,32,61,32,115,116,100,116,104,114,101,97,100,95,99,97,110,99,101,108,10,
116,104,114,101,97,100,46,101,120,105,116,32,32,32,61,32,115,116,100,116,104,114,101,97,100,95,101,120,105,116,10,
0};
#endif
#ifdef ELS_CONF_TOKEN_CN
static const char LibScript_cn[]={
-25,-70,-65,-25,-88,-117,61,123,125,10,
100,101,102,32,-25,-70,-65,-25,-88,-117,46,99,108,97,115,115,40,41,58,10,
32,32,32,32,118,97,114,32,116,104,105,115,32,61,32,123,125,10,
32,32,32,32,116,104,105,115,46,-27,-112,-81,-27,-118,-88,32,32,32,61,32,115,116,100,116,104,114,101,97,100,95,99,114,101,97,116,101,10,
32,32,32,32,116,104,105,115,46,-25,-83,-119,-27,-66,-123,32,32,32,61,32,115,116,100,116,104,114,101,97,100,95,106,111,105,110,10,
32,32,32,32,116,104,105,115,46,-27,-120,-122,-25,-90,-69,32,32,32,61,32,115,116,100,116,104,114,101,97,100,95,100,101,116,97,99,104,10,
32,32,32,32,116,104,105,115,46,-23,-128,-128,-27,-121,-70,32,32,32,61,32,115,116,100,116,104,114,101,97,100,95,101,120,105,116,10,
32,32,32,32,116,104,105,115,46,-24,-121,-86,-24,-70,-85,73,68,32,61,32,115,116,100,116,104,114,101,97,100,95,115,101,108,102,10,
32,32,32,32,114,101,116,117,114,110,32,116,104,105,115,10,
59,10,
-25,-70,-65,-25,-88,-117,46,-27,-127,-100,-26,-83,-94,32,61,32,115,116,100,116,104,114,101,97,100,95,99,97,110,99,101,108,10,
-25,-70,-65,-25,-88,-117,46,-23,-128,-128,-27,-121,-70,32,61,32,115,116,100,116,104,114,101,97,100,95,101,120,105,116,10,
0};
#endif
void ElsLib_stdthread_libinit(els_VmObj *vm){
	vm_register(vm,"stdthread_exit",ELSAPI_stdthread_stdthread_exit);
	vm_register(vm,"stdthread_self",ELSAPI_stdthread_stdthread_self);
	vm_register(vm,"stdthread_join",ELSAPI_stdthread_stdthread_join);
	vm_register(vm,"stdthread_create",ELSAPI_stdthread_stdthread_create);
	vm_register(vm,"stdthread_cancel",ELSAPI_stdthread_stdthread_cancel);
	vm_register(vm,"stdthread_detach",ELSAPI_stdthread_stdthread_detach);
	#ifdef ELS_CONF_TOKEN_EN
		vm_dostring(vm,LibScript);
	#endif
	#ifdef ELS_CONF_TOKEN_CN
		vm_dostring(vm,LibScript_cn);
	#endif
};
